/* GUI CONVERTED from ecrels0a.i (converter v1.76) Wed Jun 26 12:50:09 2002 */
/* ecrels0a.i - ECN RELEASE PRINT INCLUDE FILE                                */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.8.2.9 $                                                       */
/*V8:ConvertMode=Report                                                       */
/* REVISION: 7.4      LAST EDIT: 12/16/93      MODIFIED BY: QZL *H013*        */
/* REVISION: 7.4      LAST EDIT: 08/26/94      MODIFIED BY: QZL *H492*        */
/* REVISION: 7.4      LAST EDIT: 02/22/96      MODIFIED BY: rvw *H0JT*        */
/* REVISION: 8.6      LAST EDIT: 06/06/96       BY: Mariya Kutwal *K00C*      */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane          */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan         */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan         */
/* REVISION: 8.6E     LAST MODIFIED: 10/14/99   BY: *L0K1* Mugdha Tambe       */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane   */
/* REVISION: 9.1      LAST MODIFIED: 07/11/00   BY: *N0FJ* Mudit Mehta        */
/* REVISION: 9.1      LAST MODIFIED: 08/14/00   BY: *N0KW* Jacolyn Neder      */
/* REVISION: 9.1      LAST MODIFIED: 11/02/00   BY: *M0VW* Vandna Rohira      */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* $Revision: 1.8.2.9 $   BY: Jean Miller        DATE: 06/19/02  ECO: *P09H*  */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

ecmreldate = today.

/* TO REMOVE TRAILING WHITE SPACE IN ORACLE DATABASE */

find ecm_mstr where ecm_nbr >= right-trim(ecmnbr1)
                and ecm_nbr <= string(ecmnbr1,"x(24)")
exclusive-lock.

assign
   ecmid = substring(ecm_nbr,9,8)
   dbase = substring(ecm_nbr,17,8).

find pct_mstr where pct_type = ecm_type
                and pct_dsgn_grp = ecm_assign
no-lock no-error.

assign
   deliver_to = ""
   dtitle = progtitl.

block-01:

for each pcld_det
   fields (pcld_copies pcld_dev pcld_expire pcld_group pcld_id)
   where pcld_group  = pct_distr
     and (pcld_expire = ? or pcld_expire >= today)
no-lock:

   block-02:
   repeat ii = 0 to max((pcld_copies - 1),0):

      dev = pcld_dev.

      {ecselprt.i dev 132}
      {mfphead.i}

      if pcld_copies = 0 then do:

         /* SET EXTERNAL LABELS */
         setFrameLabels(frame dist:handle).

         display
            pcld_id
            ii
            pcld_copies
         with frame dist STREAM-IO /*GUI*/ .

         display
            " *** " +
            getTermLabel("NO_COPY_REQUESTED_CHECK_E-MAIL",45) format "x(50)"
         with frame y width 132 STREAM-IO /*GUI*/ .

         /*! SET UP E-MAIL NOTIFICATION*/
         find usr_mstr where usr_userid = pcld_id no-lock no-error.

         if available usr_mstr and usr_mail_address <> "" then do:
            if deliver_to = "" then deliver_to = usr_mail_address.
            else deliver_to = deliver_to + "," + usr_mail_address.
         end. /* IF AVAILABLE usr_mstr ... */

         /* RESET PRINTER OR CLOSE OUTPUT STREAMS */
         {mfreset.i}
/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/

         next block-01.

      end.  /* IF pcld_copies = 0 */

      display
         pcld_id
         (ii + 1) @ ii
         pcld_copies
      with frame dist STREAM-IO /*GUI*/ .

      if pcld_expire = ? or pcld_expire >= today then do:

         do with frame form01:

            /* SET EXTERNAL LABELS */
            setFrameLabels(frame form01:handle).

            display
               {ecform01.i}
            with frame form01 attr-space side-labels width 132 STREAM-IO /*GUI*/ .
         end. /* DO WITH FRAME FORM01 */

         if ecm_close_date <> ? then
            closed_yn = yes.
         else
            closed_yn = no.

         do with frame form07:

            /* SET EXTERNAL LABELS */
            setFrameLabels(frame form07:handle).

            display
               {ecform07.i}
            with frame form07 attr-space side-labels width 132 STREAM-IO /*GUI*/ .

            display
               ecmreldate @ ecm_rel_date
            with frame form07 STREAM-IO /*GUI*/ .

         end. /* DO WITH FRAME FORM07 */

      end. /* IF pcld_expire = ? OR .... */

      {mfreset.i}
/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/

      
/*GUI*/ {mfguichk.i } /*Replace mfrpchk*/


   end. /* REPEAT ii = 0 TO ... */

end. /* FOR EACH pcld_det */

/*! INVOKE E-MAIL NOTIFICATION ON RELEASE */
{gprun.i ""pcmail04.p""
   "(input recid(ecm_mstr),
     input deliver_to)"}

ecm_rel_date = ecmreldate.

/* Update pt_mstr rev level */
for each ecd_det
   fields (ecd_nbr ecd_new_rev ecd_part)
   no-lock where ecd_nbr = ecmnbr1,
   each pt_mstr exclusive-lock where pt_part = ecd_part:

   {gprun.i ""ecrevchk.p""
      "(input pt_ecn_rev,
        input ecd_new_rev,
        output error-msg-nbr)"}
   if error-msg-nbr = 0 then pt_ecn_rev = ecd_new_rev.

end. /* FOR EACH ecd_det */
